package com.hanhanxiaochong.zhongxiangchuanmei.view.my.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.hanhanxiaochong.zhongxiangchuanmei.R;
import com.hanhanxiaochong.zhongxiangchuanmei.bean.StorRewardBean;
import com.hanhanxiaochong.zhongxiangchuanmei.config.CommonAdapter;
import com.hanhanxiaochong.zhongxiangchuanmei.config.ViewHolder;
import com.hanhanxiaochong.zhongxiangchuanmei.util.StringUtils;
import com.hanhanxiaochong.zhongxiangchuanmei.view.my.act.DealDetailsActivity;

import java.util.List;

/**
 * Author : 贾桐
 * E-mail : 653773284@qq.com
 * Time   : 2018/6/9.
 * Desc   :
 */

public class StorRewardAdapter extends CommonAdapter<StorRewardBean> {

    public StorRewardAdapter(Context context, int layoutId, List<StorRewardBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, StorRewardBean storRewardBean, int position) {
        if (StringUtils.isEmpty(storRewardBean.getMoney())){
            holder.setText(R.id.txt_money, storRewardBean.getMoney());
        }
        if (StringUtils.isEmpty(storRewardBean.getName())){
            holder.setText(R.id.txt_type, storRewardBean.getName());
        }

        holder.setOnClickListener(R.id.item_lsmx, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, DealDetailsActivity.class);
                intent.putExtra("type", "1");
                intent.putExtra("id", storRewardBean.getId());
                mContext.startActivity(intent);
            }
        });
    }
}
